package com.weight.system.weight.service.impl;

import com.weight.system.weight.PO.WeightInfo;
import com.weight.system.weight.service.WeightInfoService;
import com.weight.system.weight.DAO.WeightInfoMapper;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.github.pagehelper.PageHelper;
import org.springframework.transaction.annotation.Transactional;
import com.weight.common.util.CommonUtils;
import lombok.extern.slf4j.Slf4j;

/**
 * 称重记录表
 */
@Service
@Transactional
@Slf4j
public class WeightInfoServiceImpl implements WeightInfoService {

	@Autowired
	private WeightInfoMapper weightInfoMapper;


	/**
	 * 查询称重记录信息--条件查询
	 * @param map
	 * @return
	 */
	@Override
	public List<WeightInfo> findWeightInfoByT(Map map){
		return weightInfoMapper.findWeightInfoByT(map);
	}

	/**
	 * 查询称重记录信息--条件，分页查询
	 * @param currentPage
	 * @param pageSize
	 * @param map
	 * @return
	 */
	@Override
	public List<WeightInfo> findWeightInfoByPage(int currentPage,int pageSize,Map map){
		PageHelper.startPage(currentPage, pageSize);
		List<WeightInfo> weightInfoList = weightInfoMapper.findWeightInfoByT(map);
		return weightInfoList;
	}

	/**
	 * 查询称重记录信息--查询全部
	 * @return
	 */
	@Override
	public List<WeightInfo> findAll(){
		return weightInfoMapper.findAll();
	}

	/**
	 * ID查询称重记录信息
	 * @param map
	 * @return
	 */
	@Override
	public WeightInfo findByWeightInfoId(Map map){
		WeightInfo weightInfo=weightInfoMapper.findByWeightInfoId(map);
		CommonUtils.validateExistObj(weightInfo,map);
		return weightInfo;
	}

	/**
	 * ID查询称重记录信息-批量
	 * @param weightInfoIdList
	 * @return
	 */
	@Override
	public List findByWeightInfoIdList(List weightInfoIdList){
		List idList = weightInfoMapper.findByWeightInfoIdList(weightInfoIdList);
		CommonUtils.validateExistList(idList,weightInfoIdList);
		return idList;
	}

	/**
	 * 添加称重记录
	 * @param weightInfo
	 */
	@Override
	public void insertWeightInfo(WeightInfo weightInfo){
		weightInfoMapper.insertWeightInfo(weightInfo);
	}

	/**
	 * 批量添加称重记录
	 * @param weightInfoList
	 */
	@Override
	public void insertWeightInfoBatch(List<WeightInfo> weightInfoList){
		weightInfoMapper.insertWeightInfoBatch(weightInfoList);
	}

	/**
	 * 修改称重记录
	 * @param weightInfo
	 */
	@Override
	public void updateWeightInfo(WeightInfo weightInfo){
		weightInfoMapper.updateWeightInfo(weightInfo);
	}

	/**
	 * 修改称重记录
	 * @param weightInfo
	 */
	@Override
	public void updateWeightInfoLimt(WeightInfo weightInfo){
		weightInfoMapper.updateWeightInfoLimt(weightInfo);
	}

	/**
	 * 物理删除称重记录
	 * @param map
	 */
	@Override
	public void deleteByWeightInfoId(Map map){
		weightInfoMapper.deleteByWeightInfoId(map);
	}

	/**
	 * 批量物理删除称重记录
	 * @param weightInfoIdList
	 */
	@Override
	public void deleteByWeightInfoIdBatch(List weightInfoIdList){
		weightInfoMapper.deleteByWeightInfoIdBatch(weightInfoIdList);
	}

	/**
	 * 状态删除称重记录
	 * @param map
	 */
	@Override
	public void upDelByWeightInfoId(Map map){
		weightInfoMapper.upDelByWeightInfoId(map);
	}

	/**
	 * 批量状态删除称重记录
	 * @param weightInfoList
	 */
	@Override
	public void upDelByWeightInfoIdBatch(Map<String, Object> map){
		weightInfoMapper.upDelByWeightInfoIdBatch(map);
	}

}